Validation

Set directory

Set parameters

Set filenames

1. Rasterize in situ data validation shapefile

1.2 Build y_pred and y_true

1.3 Find classes name

2. Confusion Matrix

2.1 Compute Confusion Matrix

2.2 Plot Confusion Matrix

3. Compute accuracy metrics

3.1 Accuracy Metrics

3.2 Overall Accuracy

Build a text report showing the main classification metrics

Some labels in y_test don't appear in y_pred. Specifically in this case, label '2' is never predicted:

If you decide that you are not interested in the scores of labels that were not predicted, then you can explicitly specify the labels you are interested in (which are labels that were predicted at least once).